/*
*  系统管理相关请求
*/
import axios from 'axios';
import {get,post} from '../axios/tools';
import * as URL_CONFIG from '../axios/config';

/**************************************资源管理 Start*****************************************/
export const getAllPermissions = () => get({url:URL_CONFIG.PERMISSION_GET_ALL});//查询全部资源
export const validatorPermission = (permission) => get({url:URL_CONFIG.PERMISSION_VALIDATOR + '?' + permission});
export const editOrSavePermission = (permission) => post({url:URL_CONFIG.PERMISSION_SAVE_OR_EDIT,data:permission});
export const getPermissionById = (id) => get({url:URL_CONFIG.PERMISSION_GET_BY_ID + id});
export const deletePermissionById = (id) => post({url:URL_CONFIG.PERMISSION_DELETE + id});
/**************************************资源管理 End*******************************************/

/**************************************角色管理 Start*****************************************/
export const getRolePage = (params) => get({url: URL_CONFIG.ROLE_GET_PAGE + '?' + params}); //分页查询
export const getRoleById = (id) => get({url:URL_CONFIG.ROLE_GET_BY_ID + id});//根据Id查询角色信息
export const editOrSaveRole = (role) => post({url:URL_CONFIG.ROLE_SAVE_OR_EDIT,data:role});//编辑或者新增角色
export const validatorRole = (name) => get({url:URL_CONFIG.ROLE_VALIDATOR + '?' + name});//校验角色名
export const deleteRoleById = (id) => post({url:URL_CONFIG.ROLE_DELETE + id});//根据id删除角色
export const saveRoleGo = () => get({url:URL_CONFIG.ROLE_SAVE_GO});
/**************************************角色管理 End*******************************************/

/**************************************分级管理 Start*****************************************/
export const getClassifiesAll = () => get({ url: URL_CONFIG.COMPANY_GET_ALL}); //查询全部
export const getClassifiesPage = (data) => get({ url: URL_CONFIG.COMPANY_GET_PAGE + "?" + data }); //分页查询
export const saveOrEditClassifies = (data) => post({ url: URL_CONFIG.COMPANY_SAVE_OR_EDIT, data: data});//新增/修改
export const deleteClassifies = (data) => post({url: URL_CONFIG.COMAPNY_DELETE+data.split("=")[1], data: data});//根据id删除
export const outPutClassifies = () => axios.get( URL_CONFIG.COMPANY_EXPORT, {responseType: 'blob'}); //批量导出
export const getClassifiesById = (data) => get({ url: URL_CONFIG.COMPANY_GET_BY_ID + "?" + data }); //根据id查询
export const checkClassifiName = (data) => get({ url: URL_CONFIG.COMPANY_VALIDATOR + "?" + data }); //校验分部名称
export const getInvalidate = () => get({ url: URL_CONFIG.COMPANY_INVALIDATE }); //重载缓存请求
/**************************************分级管理 End*******************************************/

/**************************************用户管理 Start*****************************************/
export const getUserPaging = (params) => get({url:URL_CONFIG.USER_GET_PAGE + '?' + params}); //分页查询
export const deleteUserById = (id) => post({url:URL_CONFIG.USER_DELETE + id});//根据id删除角色
export const editOrSaveUser = (user) => post({url:URL_CONFIG.USER_SAVE_OR_EDIT,data:user}) //编辑或者新增用户
export const validatorUser = (name) => get({url:URL_CONFIG.USER_VALIDATOR + '?' + name});//校验角色名
export const getUserById = (id) => get({url:URL_CONFIG.USER_GET_BY_ID + id});//根据Id查询用户信息
export const updatePwd = (params) => post({url:URL_CONFIG.USER_UPDATE_PWD,data:params});//修改密码
export const saveUserGo = () => get({url:URL_CONFIG.USER_SAVE_GO});
/**************************************用户管理 End*******************************************/

/**************************************操作日志管理 Start*****************************************/
export const getLogPage = (params) => get({url:URL_CONFIG.LOG_GET_PAGE +  "?" + params });
/**************************************操作日志管理 End*******************************************/

/**************************************报活信息 Start*****************************************/
export const getUsageDailyChart = (params) => get({url:URL_CONFIG.USAGE_DAILYCHART + '?' + params}); //日报活分部汇总
export const getUsageDailyChartWithIP = (params) => get({url:URL_CONFIG.USAGE_DAILYCHART_WITHIP + '?' + params}); //日报活分部详细
export const getUsageMonthChart = (params) => get({url:URL_CONFIG.USAGE_MONTHCHART + '?' + params}); //月报活分部汇总
export const getUsageMonthChartWithIP = (params) => get({url:URL_CONFIG.USAGE_MONTHCHART_WITHIP + '?' + params}); //月报活分部详细
/**************************************报活信息 End*******************************************/

/**************************************安装量 Start*****************************************/
export const getLogInstallDailyChart = (params) => get({url:URL_CONFIG.LOGINSTALL_DAILYCHART + '?' + params}); //日安装量分部汇总
export const getLogInstallDailyChartWithIP = (params) => get({url:URL_CONFIG.LOGINSTALL_DAILYCHART_WITHIP + '?' + params}); //日安装量分部详细
export const getLogInstallMonthChart = (params) => get({url:URL_CONFIG.LOGINSTALL_MONTHCHART + '?' + params}); //月安装量分部汇总
export const getLogInstallMonthChartWithIP = (params) => get({url:URL_CONFIG.LOGINSTALL_MONTHCHART_WITHIP + '?' + params}); //月安装量分部详细
export const getLogInstallGetStatistics = (params) => get({url:URL_CONFIG.LOGINSTALL_GETSTATISTICS + '?' + params}); //月安装量分部详细
/**************************************安装量 End*******************************************/

/**************************************MSO Start*****************************************/
export const getMsoMonthChart = (params) => get({url:URL_CONFIG.MSO_MONTHCHART + '?' + params}); //MSO分部汇总
export const getMsoMonthChartWithIP = (params) => get({url:URL_CONFIG.MSO_MONTHCHART_WITHIP + '?' + params}); //MSO分部详细
/**************************************MSO End*******************************************/

/**************************************卸载 Start*****************************************/
export const getLogUnInstallDailyChart = (params) => get({url:URL_CONFIG.LOGUNINSTALL_DAILYCHART + '?' + params}); //MSO分部汇总
export const getLogUnInstallMonthChartWithIP = (params) => get({url:URL_CONFIG.LOGUNINSTALL_MONTHCHART_WITHIP + '?' + params}); //MSO分部详细
/**************************************卸载 End*******************************************/

/**************************************数据导出 Start*****************************************/
export const exportData = (type,params) => axios.get(`/wpscollect/wps/${type}/export?${params}`,{responseType: 'blob'})
/**************************************数据导出 End*******************************************/
